<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            #d{
                width: 100px;
                height: 100px;
                background-color: red;
                position: absolute;
            }
        </style>
        <script>
            function f1(e){
                alert("f1...");
                alert(e)
            }

            window.onload=function(){

                document.getElementById("a2").onclick=function(){
                    alert("f2...");
                }
            }

            function move(){
                // console.log(event.clientX+" "+event.clientY);

                var d=document.getElementById("d");

                d.style.left=event.clientX+"px";
                d.style.top=event.clientY+"px";
            }

            function clickDiv(){
                // alert("div");
                window.location="js1.html";
            }
            function clickA(){
                // alert("a");
                event.cancelBubble=true;

                document.getElementById("d").style.display="none";
            }
        </script>
    </head>
    <!--<body onmousemove="move();">-->
    <body>
        <a href="javascript:;" onclick="f1();">test1</a>
        <a href="javascript:;" id="a2">test2</a>



        <div id="d" onclick="clickDiv();">
            <a href="javascript:;" onclick="clickA();">关闭</a>
        </div>

    </body>
    <script>
        // document.getElementById("a2").onclick=function(){
        //     alert("f2...");
        // }
    </script>
</html>